
#include "S_38_Filter_doGet.h"
#include "mi_iid_define.h"
#include "property_decoder.h"
#include "section_define.h"
#include "main.h"

extern uint8_t  g_uNo2RegList[PBS_NO2REGSIZE];
/**
 * 格式: property_value_new_integer(整数)　
 * 取值: 最小值: 0, 最大值: 101, 步长: 1
 */
static void P_38_1_FilterLifeLevel_doGet(property_operation_t *o)
{
	InDoorBusReg RegSection1 = {0};
#if 	PROPERTY_TYPE
	RegSection1.V8 = GetPbsRegValue(0x87);
//	if(RegSection1.BIT.bit3)
	{
		property_value_new_integer(&o->value,RegSection1.BIT.bit2);
	}
	
#else	
    o->value.format = PROPERTY_FORMAT_NUMBER;
	o->value.data.number.type = DATA_NUMBER_INTEGER;
	o->value.data.number.value.integerValue = 4; // TODO: 这里需要读到属性真正的值
#endif
    
}

/**
 * 格式: property_value_new_integer(整数)　
 * 取值: 最小值: 0, 最大值: 32767, 步长: 1
 */
static void P_38_2_FilterUserTime_doGet(property_operation_t *o)
{
	uint16_t Temp1 = 0;
#if 	PROPERTY_TYPE
//		if(Temp1 >> 15)
	Temp1 = (g_uNo2RegList[0x49]<<8) | (g_uNo2RegList[0x48]);//滤芯已使用时间
	property_value_new_integer(&o->value,(Temp1&0x7FFF));
	
#else	
    o->value.format = PROPERTY_FORMAT_NUMBER;
	o->value.data.number.type = DATA_NUMBER_INTEGER;
	o->value.data.number.value.integerValue = 4; // TODO: 这里需要读到属性真正的值
#endif
    
}

void S_38_Filter_doGet(property_operation_t *o)
{
    switch (o->piid)
    {
        case PIID_38_1_FilterLifeLevel:
            P_38_1_FilterLifeLevel_doGet(o);
            break;

		case PIID_38_2_FilterUserTime:
            P_38_2_FilterUserTime_doGet(o);
            break;
		
		
        default:
            o->code = OPERATION_ERROR_VALUE;
            break;
    }
}
